package com.depot.sys.dao;

import java.sql.SQLException;

import com.depot.domains.Users;
import com.soar.context.Environment;
import com.soar.encrypt.SoarMd5;
import com.soar.jdbc.dbhelper.DbParameter;
import com.soar.jdbc.dbhelper.DbTemplates;
import com.soar.jdbc.dbhelper.SameTypes;
import com.soar.jdbc.dbhelper.SqlTypes;
import com.soar.jdbc.dbhelper.WhereTypes;

/**
 * 
 * @author zhangaoxiang
 * @version $Revision$ - $Author$ at $Date$
 * @description com.itaskstar.sys.web.UserLoginDao
 */
public class UserForgetDao
{

	public static String forgetpsw(Environment env, Users domain) throws SQLException
	{
		DbParameter param = null;
		param = new DbParameter("USERS T1");
		param.setParams("PASSWORD", new SoarMd5().getMd5(domain.getPassword()), SqlTypes.CHAR);
		param.setParams("UPDATE_DATE", "sysdate", SqlTypes.CUSTOM);
		param.setWhereParams("MOBILE", domain.getMobile(), SqlTypes.VARCHAR, WhereTypes.AND, SameTypes.YES);
		if (DbTemplates.update(env.getConnection(), param))
		{
			return "1";
		}
		else
		{
			return "0";
		}
	}

}
